<template>
  <div class="priceWrapper">
    <div class="top">
      <span
        class="flag fontw"
        :class="[
          data.priceType === quotationDict.priceType.pricing.value
            ? pricingPriceChange(data.futuresContract)
            : 'danger'
        ]"
        >￥</span
      >
      <span
        class="price-pricing fs-18 fontw"
        :class="pricingPriceChange(data.futuresContract)"
        v-if="data.priceType === quotationDict.priceType.pricing.value"
        >{{ getPricingPrice(data.futuresContract, data.premium) }}
      </span>
      <span class="price-confirm fs-18 fontw danger" v-else
        >{{ data.price }}
      </span>
    </div>
    <div
      class="bottom"
      v-if="data.priceType === quotationDict.priceType.pricing.value"
    >
      <span class="contract">{{ data.futuresContract }}</span>
      <span class="premium"
        ><i v-if="data.premium >= 0">+</i>{{ data.premium }}</span
      >
    </div>
  </div>
</template>

<script>
import { getPricingPrice } from "@/util/mixins/getPricingPrice";
import quotationDict from "@/dict/quotation";

export default {
  props: {
    // 报价信息
    data: {
      type: Object
    }
  },
  mixins: [getPricingPrice],
  data() {
    return {
      quotationDict
    };
  }
};
</script>

<style lang="scss" scoped>
.premium {
  margin-left: 5px;
}
</style>
